package com.css.zfzx.data.util;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;

public class DateUtil {

    /**
     * 获取yyyyMMdd HH:mm:ss
     * @param date
     * @return
     */
    public static  String getContainsHMS(Date date) {
        if (date != null){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd HH:mm:ss");
            String format = sdf.format(date);
            return format;
     }else {
            return "时间不能为空";
        }
    }
    /**
     * 获取yyyyMMdd
     * @param date
     * @return
     */
    public static  String getNotContainsHMS(Date date) {
        if (date != null){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
            String format = sdf.format(date);
            return format;
        }else {
            return "时间不能为空";
        }
    }
}
